#ifndef XPM_UNDO_H
#define XPM_UNDO_H

enum Undo_Action_Type {
  xpm_undefined_undo = 0,
  xpm_bitmap_undo = 1,
  xpm_image_undo = 2,
  xpm_size_undo = 3
};

struct xpm_undo_action {
  Undo_Action_Type UndoType;
  void *pData;
};

class XPMUndo {
  public:
    XPMUndo();
    ~XPMUndo();
    void SetParentPanel( XPMEditorPanel *pPanel );
    XPMEditorPanel* GetParentPanel( void );
    void SetMaxUndoSize( long lSize );
    long GetMaxUndoSize( void );
    bool IncreaseMemoryUndo( void );
    bool IncreaseMemoryRedo( void );
    void ClearUndoBuffer( void );
    void ClearRedoBuffer( void );
    void ReleaseUndoBuffer( void );
    void ReleaseRedoBuffer( void );
    bool CanUndo( void );
    bool CanRedo( void );
    bool AddUndo( Undo_Action_Type iType, void *pData,
                  bool bClearRedo = true );
    bool AddRedo( Undo_Action_Type iType, void *pData );
    void Undo( void );
    void Redo( void );

  private:
    xpm_undo_action *UndoBuffer;
    xpm_undo_action *RedoBuffer;
    long lUndoSize;
    long lUndoMax;
    long lRedoSize;
    long lRedoMax;

    long lMaxUndoRedo;

    void ReleaseUndoRedoAction( int iUndoRedo, long lIndex );

    XPMEditorPanel *parent;
    void PerformAction( XPMEditorPanel *parent, xpm_undo_action *buffer, long lIndex );


};

#endif
